<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Chapter 5.  The DB_ENV Handle</title>
    <link rel="stylesheet" href="apiReference.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB C API Reference" />
    <link rel="up" href="index.html" title="Berkeley DB C API Reference" />
    <link rel="prev" href="DB_MULTIPLE_RECNO_RESERVE_NEXT.html" title="DB_MULTIPLE_RECNO_RESERVE_NEXT" />
    <link rel="next" href="envadd_data_dir.html" title="DB_ENV-&gt;add_data_dir()" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Chapter 5. 
                The DB_ENV Handle
        </th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="DB_MULTIPLE_RECNO_RESERVE_NEXT.html">Prev</a> </td>
          <th width="60%" align="center"> </th>
          <td width="20%" align="right"> <a accesskey="n" href="envadd_data_dir.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="chapter" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title"><a id="env"></a>Chapter 5. 
                The DB_ENV Handle
        </h2>
          </div>
        </div>
      </div>
      <p>
        The <code class="classname">DB_ENV</code> object is the handle for a Berkeley DB environment
        — a collection including support for some or all of caching, locking, logging and
        transaction subsystems, as well as databases and log files. Methods of the
        <code class="classname">DB_ENV</code> handle are used to configure the environment as well as
        to operate on subsystems and databases in the environment.
    </p>
      <p>
        <code class="classname">DB_ENV</code> handles 
        <span>
            are created using the <a class="xref" href="envcreate.html" title="db_env_create">db_env_create</a>
            method, and 
        </span>
        are opened using the <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
        method.
    </p>
      <p>
        When you are done using your environment, close it using the 
        <a class="xref" href="envclose.html" title="DB_ENV-&gt;close()">DB_ENV-&gt;close()</a> method. Before closing your
        environment, make sure all open database handles are closed first. See the
        <a class="xref" href="dbclose.html" title="DB-&gt;close()">DB-&gt;close()</a> method for more information.
    </p>
      <div class="sect1" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title" style="clear: both"><a id="envlist"></a>Database Environments and Related Methods</h2>
            </div>
          </div>
        </div>
        <div class="navtable">
          <table border="1" width="80%">
            <thead>
              <tr>
                <th>Database Environment Operations</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>
                  <a class="xref" href="envbackup.html" title="DB_ENV-&gt;backup()">DB_ENV-&gt;backup()</a>
                </td>
                <td>Hot back up an entire environment</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envclose.html" title="DB_ENV-&gt;close()">DB_ENV-&gt;close()</a>
                </td>
                <td>Close an environment</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envcreate.html" title="db_env_create">db_env_create</a>
                </td>
                <td>Create an environment handle</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envdbbackup.html" title="DB_ENV-&gt;dbbackup()">DB_ENV-&gt;dbbackup()</a>
                </td>
                <td>Hot back up a single environment file</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envdbremove.html" title="DB_ENV-&gt;dbremove()">DB_ENV-&gt;dbremove()</a>
                </td>
                <td>Remove a database</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envdbrename.html" title="DB_ENV-&gt;dbrename()">DB_ENV-&gt;dbrename()</a>
                </td>
                <td>Rename a database</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="enverr.html" title="DB_ENV-&gt;err()">DB_ENV-&gt;err()</a>
                </td>
                <td>Error message</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envfailchk.html" title="DB_ENV-&gt;failchk()">DB_ENV-&gt;failchk()</a>
                </td>
                <td>Check for thread failure</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envfileid_reset.html" title="DB_ENV-&gt;fileid_reset()">DB_ENV-&gt;fileid_reset()</a>
                </td>
                <td>Reset database file IDs</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envfullversion.html" title="db_full_version">db_full_version</a>
                </td>
                <td>Return full version information</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="dbgetenv.html" title="DB-&gt;get_env()">DB-&gt;get_env()</a>
                </td>
                <td>Return the DB's underlying DB_ENV handle </td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envget_home.html" title="DB_ENV-&gt;get_home()">DB_ENV-&gt;get_home()</a>
                </td>
                <td>Return environment's home directory</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envget_open_flags.html" title="DB_ENV-&gt;get_open_flags()">DB_ENV-&gt;get_open_flags()</a>
                </td>
                <td>Return flags with which the environment was opened</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envget_slices.html" title="DB_ENV-&gt;get_slices()">DB_ENV-&gt;get_slices()</a>
                </td>
                <td>Returns an array of slice environments</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envlog_verify.html" title="DB_ENV-&gt;log_verify()">DB_ENV-&gt;log_verify()</a>
                </td>
                <td>Verify log files of an environment</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envlsn_reset.html" title="DB_ENV-&gt;lsn_reset()">DB_ENV-&gt;lsn_reset()</a>
                </td>
                <td>Reset database file LSNs</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envmsg.html" title="DB_ENV-&gt;msg()">DB_ENV-&gt;msg()</a>
                </td>
                <td>Informational message</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
                </td>
                <td>Open an environment</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envremove.html" title="DB_ENV-&gt;remove()">DB_ENV-&gt;remove()</a>
                </td>
                <td>Remove an environment</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envstat.html" title="DB_ENV-&gt;stat_print()">DB_ENV-&gt;stat_print()</a>
                </td>
                <td>Environment statistics</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envstrerror.html" title="db_strerror">db_strerror</a>
                </td>
                <td>Error strings</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envversion.html" title="db_version">db_version</a>
                </td>
                <td>Return version information</td>
              </tr>
              <tr>
                <td colspan="2">
                  <span class="bold">
                    <strong>Environment Configuration</strong>
                  </span>
                </td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envadd_data_dir.html" title="DB_ENV-&gt;add_data_dir()">DB_ENV-&gt;add_data_dir()</a>
                </td>
                <td>Add an environment data directory</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envget_slice_count.html" title="DB_ENV-&gt;get_slice_count()">DB_ENV-&gt;get_slice_count()</a>
                </td>
                <td>Returns the number of slices configured for the environment</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_alloc.html" title="DB_ENV-&gt;set_alloc()">DB_ENV-&gt;set_alloc()</a>
                </td>
                <td>Set local space allocation functions</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_app_dispatch.html" title="DB_ENV-&gt;set_app_dispatch()">DB_ENV-&gt;set_app_dispatch()</a>
                </td>
                <td>Configure application recovery callback</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_backup_callbacks.html" title="DB_ENV-&gt;set_backup_callbacks()">DB_ENV-&gt;set_backup_callbacks()</a>, <a class="xref" href="envget_backup_callbacks.html" title="DB_ENV-&gt;get_backup_callbacks()">DB_ENV-&gt;get_backup_callbacks()</a></td>
                <td>Set/get callbacks used for environment hot backups</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_backup_config.html" title="DB_ENV-&gt;set_backup_config()">DB_ENV-&gt;set_backup_config()</a>, <a class="xref" href="envget_backup_config.html" title="DB_ENV-&gt;get_backup_config()">DB_ENV-&gt;get_backup_config()</a></td>
                <td>Set/get environment hot backup configuration options</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_data_dir.html" title="DB_ENV-&gt;set_data_dir()">DB_ENV-&gt;set_data_dir()</a>, <a class="xref" href="envget_data_dirs.html" title="DB_ENV-&gt;get_data_dirs()">DB_ENV-&gt;get_data_dirs()</a></td>
                <td>Set/get the environment data directory</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_data_len.html" title="DB_ENV-&gt;set_data_len()">DB_ENV-&gt;set_data_len()</a>, <a class="xref" href="envget_data_len.html" title="DB_ENV-&gt;get_data_len()">DB_ENV-&gt;get_data_len()</a></td>
                <td>Set/get the command line utility byte limit</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_create_dir.html" title="DB_ENV-&gt;set_create_dir()">DB_ENV-&gt;set_create_dir()</a>, <a class="xref" href="envget_create_dir.html" title="DB_ENV-&gt;get_create_dir()">DB_ENV-&gt;get_create_dir()</a></td>
                <td>Add an environment data directory</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_encrypt.html" title="DB_ENV-&gt;set_encrypt()">DB_ENV-&gt;set_encrypt()</a>, <a class="xref" href="envget_encrypt_flags.html" title="DB_ENV-&gt;get_encrypt_flags()">DB_ENV-&gt;get_encrypt_flags()</a></td>
                <td>Set/get the environment cryptographic key</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envevent_notify.html" title="DB_ENV-&gt;set_event_notify()">DB_ENV-&gt;set_event_notify()</a>
                </td>
                <td>Set event notification callback</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_errcall.html" title="DB_ENV-&gt;set_errcall()">DB_ENV-&gt;set_errcall()</a>
                </td>
                <td>Set error message callbacks</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_errfile.html" title="DB_ENV-&gt;set_errfile()">DB_ENV-&gt;set_errfile()</a>, <a class="xref" href="envget_errfile.html" title="DB_ENV-&gt;get_errfile()">DB_ENV-&gt;get_errfile()</a></td>
                <td>Set/get error message FILE</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_errpfx.html" title="DB_ENV-&gt;set_errpfx()">DB_ENV-&gt;set_errpfx()</a>, <a class="xref" href="envget_errpfx.html" title="DB_ENV-&gt;get_errpfx()">DB_ENV-&gt;get_errpfx()</a></td>
                <td>Set/get error message prefix</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_feedback.html" title="DB_ENV-&gt;set_feedback()">DB_ENV-&gt;set_feedback()</a>
                </td>
                <td>Set feedback callback</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_flags.html" title="DB_ENV-&gt;set_flags()">DB_ENV-&gt;set_flags()</a>, <a class="xref" href="envget_flags.html" title="DB_ENV-&gt;get_flags()">DB_ENV-&gt;get_flags()</a></td>
                <td>Environment configuration</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_intermediate_dir_mode.html" title="DB_ENV-&gt;set_intermediate_dir_mode()">DB_ENV-&gt;set_intermediate_dir_mode()</a>, <a class="xref" href="envget_intermediate_dir_mode.html" title="DB_ENV-&gt;get_intermediate_dir_mode()">DB_ENV-&gt;get_intermediate_dir_mode()</a></td>
                <td>Set/get intermediate directory creation mode</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_isalive.html" title="DB_ENV-&gt;set_isalive()">DB_ENV-&gt;set_isalive()</a>
                </td>
                <td>Set thread is-alive callback</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_memory_init.html" title="DB_ENV-&gt;set_memory_init()">DB_ENV-&gt;set_memory_init()</a>, <a class="xref" href="envget_memory_init.html" title="DB_ENV-&gt;get_memory_init()">DB_ENV-&gt;get_memory_init()</a></td>
                <td>Set/get initial memory allocation</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_memory_max.html" title="DB_ENV-&gt;set_memory_max()">DB_ENV-&gt;set_memory_max()</a>, <a class="xref" href="envget_memory_max.html" title="DB_ENV-&gt;get_memory_max()">DB_ENV-&gt;get_memory_max()</a></td>
                <td>Set/get maximum memory allocation</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_metadata_dir.html" title="DB_ENV-&gt;set_metadata_dir()">DB_ENV-&gt;set_metadata_dir()</a>, <a class="xref" href="envget_metadata_dir.html" title="DB_ENV-&gt;get_metadata_dir()">DB_ENV-&gt;get_metadata_dir()</a></td>
                <td>Set/get the directory containing environment metadata </td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_msgcall.html" title="DB_ENV-&gt;set_msgcall()">DB_ENV-&gt;set_msgcall()</a>
                </td>
                <td>Set informational message callback</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_msgfile.html" title="DB_ENV-&gt;set_msgfile()">DB_ENV-&gt;set_msgfile()</a>, <a class="xref" href="envget_msgfile.html" title="DB_ENV-&gt;get_msgfile()">DB_ENV-&gt;get_msgfile()</a></td>
                <td>Set/get informational message FILE</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_msgpfx.html" title="DB_ENV-&gt;set_msgpfx()">DB_ENV-&gt;set_msgpfx()</a>, <a class="xref" href="envget_msgpfx.html" title="DB_ENV-&gt;get_msgpfx()">DB_ENV-&gt;get_msgpfx()</a></td>
                <td>Set/get informational message prefix</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_shm_key.html" title="DB_ENV-&gt;set_shm_key()">DB_ENV-&gt;set_shm_key()</a>, <a class="xref" href="envget_shm_key.html" title="DB_ENV-&gt;get_shm_key()">DB_ENV-&gt;get_shm_key()</a></td>
                <td>Set/get system memory shared segment ID</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_thread_count.html" title="DB_ENV-&gt;set_thread_count()">DB_ENV-&gt;set_thread_count()</a>, <a class="xref" href="envget_thread_count.html" title="DB_ENV-&gt;get_thread_count()">DB_ENV-&gt;get_thread_count()</a></td>
                <td>Set/get approximate thread count</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_thread_id.html" title="DB_ENV-&gt;set_thread_id()">DB_ENV-&gt;set_thread_id()</a>
                </td>
                <td>Set thread of control ID function</td>
              </tr>
              <tr>
                <td>
                  <a class="xref" href="envset_thread_id_string.html" title="DB_ENV-&gt;set_thread_id_string()">DB_ENV-&gt;set_thread_id_string()</a>
                </td>
                <td>Set thread of control ID format function</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_timeout.html" title="DB_ENV-&gt;set_timeout()">DB_ENV-&gt;set_timeout()</a>, <a class="xref" href="envget_timeout.html" title="DB_ENV-&gt;get_timeout()">DB_ENV-&gt;get_timeout()</a></td>
                <td>Set/get lock and transaction timeout</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_tmp_dir.html" title="DB_ENV-&gt;set_tmp_dir()">DB_ENV-&gt;set_tmp_dir()</a>, <a class="xref" href="envget_tmp_dir.html" title="DB_ENV-&gt;get_tmp_dir()">DB_ENV-&gt;get_tmp_dir()</a></td>
                <td>Set/get the environment temporary file directory</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_verbose.html" title="DB_ENV-&gt;set_verbose()">DB_ENV-&gt;set_verbose()</a>, <a class="xref" href="envget_verbose.html" title="DB_ENV-&gt;get_verbose()">DB_ENV-&gt;get_verbose()</a></td>
                <td>Set/get verbose messages</td>
              </tr>
              <tr>
                <td><a class="xref" href="envset_cachesize.html" title="DB_ENV-&gt;set_cachesize()">DB_ENV-&gt;set_cachesize()</a>, <a class="xref" href="envget_cachesize.html" title="DB_ENV-&gt;get_cachesize()">DB_ENV-&gt;get_cachesize()</a></td>
                <td>Set/get the environment cache size</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="DB_MULTIPLE_RECNO_RESERVE_NEXT.html">Prev</a> </td>
          <td width="20%" align="center"> </td>
          <td width="40%" align="right"> <a accesskey="n" href="envadd_data_dir.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">DB_MULTIPLE_RECNO_RESERVE_NEXT </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> DB_ENV-&gt;add_data_dir()</td>
        </tr>
      </table>
    </div>
  </body>
</html>
